################ Server Check Start #####################

THIS_SERVER=`hostname`

#RND
case "${THIS_SERVER}" in "hpdev05")
export DIR_HOME=/userdir/liimapp/rnhim
esac

#PROD
case "${THIS_SERVER}" in "niimwas01" | "niimwas02" )
export DIR_HOME=/userdir/liimapp/pnhim
esac

################# Server Check End #####################

rm -rf ${DIR_HOME}/Applications/NHImDstbtAgent/bin
mkdir ${DIR_HOME}/Applications/NHImDstbtAgent/bin

export AGENT_ROOT=Applications/NHImDstbtAgent
export AGENT_LIB=Applications/NHImDstbtAgent/lib
export AGENT_SRC=Applications/NHImDstbtAgent/src

export JAVA_HOME=/opt/java6
export CLASSPATH=.:${DIR_HOME}/${AGENT_LIB}/commons-pool-1.4.jar${JARFILE}:${DIR_HOME}/${AGENT_ROOT}/bin:${DIR_HOME}/${AGENT_LIB}/commons-logging-1.1.jar:${DIR_HOME}/${AGENT_LIB}/classes12.jar

cd  ${DIR_HOME}/${AGENT_SRC}

$JAVA_HOME/bin/javac ${DIR_HOME}/${AGENT_SRC}/*.java -classpath $CLASSPATH -d ${DIR_HOME}/${AGENT_ROOT}/bin

echo "################# Compile Check Start #####################"

a=$(find ${DIR_HOME}/Applications/NHImDstbtAgent/bin -name '*$*' -type f | wc -l)
b=$(find ${DIR_HOME}/Applications/NHImDstbtAgent/bin -type f | wc -l)
c=$(find ${DIR_HOME}/Applications/NHImDstbtAgent/src -type f | wc -l)

d=`expr $b - $a`
e=`expr $c`
echo class count :: $d
echo source count :: $e

if [ $d -eq $e ] ; then
   echo "Compile Success"
else
   echo "Compile Fail"
fi
echo "################# Compile Check End #####################"
